package com.junjie.checkin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.junjie.checkin.entity.TActivity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface ActivityHistoryMapper extends BaseMapper<TActivity> {

    /**
     * 获取用户参加的次数
     * @param id
     * @return
     */
    @Select("select count(id) from t_student_activity_history where user_id = #{id}")
    Integer getJoinActivity(Integer id);


    /**
     * 获取用户完成的次数
     * @param id
     * @return
     */
    @Select("select count(id) from t_student_activity_history where status = 'signIn' and user_id = #{id}")
    Integer getOverActivity(Integer id);

    /**
     * 获取用户未开始的活动次数
     * @param id
     * @return
     */
    Integer getNotStartedActivity(Integer id);

    /**
     *
     * @param id
     * @return
     */
    @Select("select count(id) from t_student_activity_history where status = 'registered' and user_id = #{id}")
    Integer getUnfinishedActivity(Integer id);

    Integer contPointMap(Map map);
}
